Open
Conversation
Owner
|
Finally found the time to have a look - it looks quite promising!
|
Author
|
Thanks for the feedback!
The JS version of bunyan allows an “arbitrary JS expression” for a filter. One of the advantages of a dynamic language! I started with a simple one-field comparison to get started, a chain of comparisons would be a logical next step – but I don’t know if defining a “language” for something more complicated than that would be worth the effort.
|
…single field value - not an arbitrary JS expression like the .js version of bunyan. It will recursively dive into nested objects in the extras structure. It only attempts to match the first key that it finds - ignoring other keys with the same name in nested structures. It also does not allow for matching against array values (including objects in arrays). 2 clean-up items: breaking change in predicate (similar->diff), and a few clippy warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still in draft form - but the tests pass. Created an option -c (compare) based on the description of the node version of bunyan. Currently implemented for a few of the easy base JSON fields. Constrained to the comparison operators, rather than "any javascript" the node version allows. Intend on expanding to include the JSON in the "extra" field as well.
Not sure the effort to create types for the comparison is necessary - as that will not be possible for the free-form JSON in the extra field. Might need to simplify this down to just String comparisons.